﻿using System;
using System.Collections.Generic;

using System.Windows.Threading;

namespace EagleJournal.Components
{
    public static class EagleNotification
    {
        private static CharmNotif notificationCharm;

        public static void Attach       (CharmNotif notif)
        {
            notificationCharm = notif;
        }
        public static void Remove       ()
        {
            notificationCharm = null;
        }

        public static void ShowAlert    (string message)
        {
            if (notificationCharm != null)
                notificationCharm.Dispatcher.Invoke(new Action(() =>
                {
                    notificationCharm.ShowNotifCharm(message);
                }), DispatcherPriority.Normal, null);
            else
                throw new NullReferenceException("Please attach a Notification charm to this action!");
        }
    }
}
